package com.vic.queue_param.arguments.x_expires;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import com.vic.utils.RabbitmqUtils;

public class Test_expires_consumer {

    public static void main(String[] argv) throws Exception {
        Channel channel = RabbitmqUtils.getChannel();

        String QUEUE_NAME = "queue_x_expires";
        DeliverCallback deliverCallback = (consumerTag, delivery) -> {
            String message = new String(delivery.getBody(), "UTF-8");
            System.out.println("Received '" + message + "'");
        };
        // 自动消息确认
        boolean autoAck = true;
        channel.basicConsume(QUEUE_NAME, autoAck, deliverCallback, consumerTag -> { });
    }
}